package com.shop.order.controller;

import com.shop.api.feign.OrderFeign;
import com.shop.constant.Const;
import com.shop.utils.CookieUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.Base64Utils;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
public class OrderController {

    private static final Logger logger = LoggerFactory.getLogger(OrderController.class);

    @Autowired
    private OrderFeign orderFeign;

    @RequestMapping("/order/getOrderInfo")
    public String showOrder(String ids, String nums, Model model, HttpServletResponse response, HttpServletRequest request) {
        Model model1 = orderFeign.showOrder(ids, nums, model, response, request);
        model = model1;
        return "order";
    }

    @RequestMapping("/order/getPay")
    public String getPay(String orderItemCodes , String orderNums , String address , float shippingPrice , HttpServletResponse response, HttpServletRequest request) {
        Model pay = orderFeign.getPay(orderItemCodes, orderNums, address, shippingPrice, request, response);
        return "success";
    }
}
